package exc;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Hello {
	public static void main(String args[]) {
		boolean assertTest = (1 + 22) > 2;
		assert assertTest : (1 + 2) > 2;
		System.out.println(assertTest);
		SimpleDateFormat sf = new SimpleDateFormat("MMddyyyy");
		System.out.println(sf.format(new Date()));
		Scanner sc = new Scanner(System.in);
		for (;;) {
			System.out.println();
			System.out.println("请输入字符串：");
			StringBuffer sb = new StringBuffer(sc.nextLine());
			if (sb.toString().contains("sb") || sb.toString().contains("sb".toUpperCase())) {
				System.out.println("草，不文明的家伙你被禁言了...0.0");
				return;
			} else {
				executeCountString(sb);
			}
		}
	}

	private static void executeCountString(StringBuffer sb) {
		Map<Character, Integer> map = new HashMap<Character, Integer>();
		for (int i = 0; i < sb.length(); i++) {
			int count = 0;
			char c = sb.charAt(i);

			for (int j = 0; j < sb.length(); j++) {
				if (c == sb.charAt(j)) {
					count++;
				}
			}
			map.put(c, count);
		}

		System.out.println("字符串中所含字符串及出现次数为： " + map.toString());
		System.out.println("字符串中共有字符种类为： " + map.size());
	}
}
